<template>
  <div class="home">
    <h1>欢迎来到首页</h1>
    <p>您已成功登录！</p>
    <button @click="logout" class="logout-btn">退出登录</button>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'

export default {
  name: 'HomeView',
  setup() {
    const router = useRouter()

    const logout = () => {
      localStorage.removeItem('token')
      localStorage.removeItem('user')
      router.push('/login')
    }

    return {
      logout
    }
  }
}
</script>

<style scoped>
.home {
  text-align: center;
  padding: 50px;
}

.logout-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.logout-btn:hover {
  background: #c82333;
}
</style> 